package com.xbao.controller;

import com.xbao.core.http.CommRequest;
import com.xbao.core.http.CommResult;
import com.xbao.model.MAnswer;
import com.xbao.model.req.MAnswerReq;
import com.xbao.model.req.MVideoReq;
import com.xbao.model.req.StuAccountReq;
import com.xbao.model.vo.MVideoVo;
import com.xbao.model.vo.StuAccountVo;
import com.xbao.service.MAnswerService;
import com.xbao.service.MVideoService;
import com.xbao.service.StuAccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by qingshengzheng on 18/11/2.
 */
@Api(value = "/video", tags = "video")
@RequestMapping(value = "video")
@Controller
@EnableAutoConfiguration
public class VideoController extends BaseController {
    @Resource
    private MVideoService mVideoService;
    @Resource
    private MAnswerService mAnswerService;

    @ApiOperation(value = "getVideos", notes = "getVideos")
    @RequestMapping(value = "/getVideos",method = RequestMethod.POST)
    @ResponseBody
    public CommResult getVideos(@RequestBody CommRequest<MVideoReq> mVideoReqCommRequest) {
        List<MVideoVo> vos= mVideoService.getMVideos(mVideoReqCommRequest);
        return new CommResult(vos);
    }

    @ApiOperation(value = "getAnswers", notes = "getAnswers")
    @RequestMapping(value = "/getAnswers",method = RequestMethod.POST)
    @ResponseBody
    public CommResult getAnswers(@RequestBody CommRequest<MAnswerReq> mVideoReqCommRequest) {
        List<MAnswer> vos= mAnswerService.getAnswers(mVideoReqCommRequest);
        return new CommResult(vos);
    }


}
